package com.xianyun.site.support.domain.model;

import com.alibaba.cola.domain.Entity;
import com.xianyun.common.core.utils.EncryptUtils;
import com.xianyun.common.core.utils.StringUtils;
import lombok.Data;

/**
 * @author mac_zyj
 */
@Data
@Entity
public class SmtpMessage extends ReceiveMessage{
    private String toAddress;
    private String checkCode;
    private String message;
    private String fileKey;
    private String fileLocation;


    public boolean codeIsTrue(String redisCode){
        if (StringUtils.isNotEmpty(this.checkCode)){
            String decryptCode = EncryptUtils.decrypt(redisCode);
            return decryptCode.equals(this.checkCode);
        }
        return false;
    }
}
